@use '../base/mixins' as *;

body.diagnostics {
  --chip-border-color: var(--site-outline);
  --chip-selected-container-color: var(--site-secondaryContainer-bgColor);
  --chip-text-color: var(--site-base-fgColor);

  --menu-border-color: var(--site-inset-borderColor);
  --menu-container-color: var(--site-inset-bgColor);
  --menu-item-container-color: transparent;
  --menu-item-selected-container-color: var(--site-secondaryContainer-bgColor);
  --menu-item-text-color: var(--site-base-fgColor);

  // Overrides of existing variables.
  --card-min-width: 19rem;

  .filter-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .card {
    .card-title {
      padding-right: 2rem;
    }

    .card-actions {
      margin-top: auto;
      padding-top: 0.5rem;

      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: flex-end;
      gap: 0.5rem;

      div {
        display: flex;

        &.leading {
          gap: 0.25rem;
          user-select: none;

          span {
            color: var(--site-base-fgColor-alt);
            font-size: 20px;
            font-variation-settings: 'FILL' 1;
          }
        }

        &.trailing {
          gap: 0.5rem;
        }
      }
    }
  }

  .chip-set {
    display: flex;
    flex-direction: row;
    text-wrap: nowrap;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
  }

  button.chip {
    border: 1px solid var(--chip-border-color);
    border-radius: 8px;
    height: 2rem;
    padding: 0 .5rem;
    background: none;
    color: var(--chip-text-color);
    font-weight: 500;
    user-select: none;

    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-family: var(--site-ui-fontFamily);

    .label {
      background: none;
    }

    &:hover {
      @include interaction-style(4%);
    }

    &:active {
      @include interaction-style(8%);
    }

    &:focus-visible {
      outline: 2px solid var(--site-primary-color);
      border-color: transparent;
    }

    .chip-icon {
      align-self: center;
      fill: currentcolor;
      position: relative;
      height: 18px;
      width: 18px;
    }

    .leading-icon {
      display: none;
      margin-right: 0.25rem;
    }
  }

  button.chip {
    &.selected {
      background-color: var(--chip-selected-container-color);
      border: none;

      .leading-icon {
        display: flex;
      }
    }
  }

  .button-menu-wrapper {
    position: relative;

    .select-menu {
      display: none;
      position: absolute;
      overflow: auto;
      z-index: 5;
      background-color: var(--menu-container-color);
      border-radius: 0.5rem;
      border: 1px solid var(--menu-border-color);
      min-width: 100%;
      max-height: 15rem;
      overflow-y: auto;
      scrollbar-width: thin;
      overscroll-behavior: contain;
      margin-top: 0.25rem;

      ul {
        list-style-type: none;
        padding: 0;
        margin: 0;
        width: 100%;

        li {
          &:first-child {
            padding-top: 0.5rem;
          }

          &:last-child {
            padding-bottom: 0.5rem;
          }
        }

        // Menu item button.
        button {
          padding: 0.2rem 0.75rem 0.2rem 0.5rem;
          width: 100%;
          border: none;
          background: none;
          color: var(--menu-item-text-color);
          font-weight: 500;
          text-align: left;
          user-select: none;
          font-family: var(--site-ui-fontFamily);

          &:hover {
            @include interaction-style(4%);
          }

          &:focus {
            @include interaction-style(6%);
          }

          &:active {
            @include interaction-style(8%);
          }

          display: flex;
          flex-direction: row;

          span.material-symbols {
            align-self: center;
            vertical-align: center;
            fill: currentcolor;
            position: relative;
            font-size: 1.25rem;
            margin-right: 0.4rem;

            font-variation-settings: 'FILL' 1;
          }

          &.selected {
            background-color: var(--menu-item-selected-container-color);
          }
        }
      }

      &.show-menu {
        display: flex;
      }
    }
  }
}
